let persons = [
    { "username": "xiaoming1", "password": "1111" },
    {"username":"xiaoming2","password":"222"},
    {"username":"xiaoming3","password":"33333"}
]
let phone = document.querySelector('#tel')
let pass = document.querySelector('#pass')

// 登录点击事件
let obtn = document.querySelector('.ologinbtn')
console.log(obtn);
obtn.addEventListener('click', (e) => { 
   
    var pval = phone.value;
    var passval = pass.value;
    var str = {};
    var tag=persons.find((item) => { 
        return item.username == pval
    })
    if (tag) {
        alert('换一个账号')
    } else if (pval == "") {
        alert('请输入手机号')
    }
    else { 
        str.username = pval;
        str.password = passval;
        persons.push(str)
        console.log(persons);
        window.open('./login.html')    
    }
    e.preventDefault();
})


